using System.Collections.Generic;
using System.Linq;

namespace Mbl.ParameterizedTest.FluentCollectionBuilding.Expectors.EnumerableExpectations
{
    public class ContainsAllExpectation<TElement> : PredicateExpectation<IEnumerable<TElement>>        
    {
        private readonly IList<TElement> _expected;

        public ContainsAllExpectation(IList<TElement> expectedElements)
            : base(actual => expectedElements.All(actual.Contains))
        {
            _expected = expectedElements;
        }

        protected override string GetErrorMessage(IEnumerable<TElement> actual)
        {
            return $"Expected '{CollectionFormatter.Format(actual)}' to contain all of '{CollectionFormatter.Format(_expected)}'";
        }
    }
}